from _hellchin_webrun.src.core.browser.base import BaseTest
# from playwright.sync_api import Page

# from _hellchin_webrun.src.core.utils.logger.run_logger import TestLogger
from _hellchin_webrun.src.core.utils.chinese_alias import KeyWordManage


class PageWaitMixin(BaseTest):
    """等待相关方法"""

    def sleep(self, timeout=1000):
        """
        等待指定时间
        :param timeout: 超时时间(毫秒)
        :return:
        """

        # TestLogger.log_action("等待", f"{timeout}ms", "start")
        # TestLogger.start.suit_log("等待", f"{timeout}ms")
        self.page.wait_for_timeout(timeout)
        # TestLogger.log_action("等待", f"{timeout}ms")
        # TestLogger.success.suit_log("等待", f"{timeout}ms")

    @KeyWordManage.chinese_alias("强制等待")
    def wait_for_time(self, timeout=20000):
        """设置强制等待时间"""
        # TestLogger.start.suit_log("强制等待", f"{timeout}ms")
        self.page.wait_for_timeout(timeout)
        # TestLogger.success.suit_log("强制等待", f"{timeout}ms")
